﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
using static NewChillers.ViewModels.ManualControlViewModel;

namespace NewChillers.Utils
{
    public class ManualStepToBackgroundConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is CurrentOperationType currentStep && parameter is string targetStep)
            {
                try
                {
                    var target = (CurrentOperationType)Enum.Parse(typeof(CurrentOperationType), targetStep);

                    // 如果是当前步骤，返回浅蓝色背景
                    if (currentStep == target)
                    {
                        return new SolidColorBrush(Color.FromArgb(30, 33, 150, 243)); // 浅蓝色，透明度30
                    }
                }
                catch
                {
                    return Brushes.Transparent;
                }
            }
            return Brushes.Transparent;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
